package acn.spring.shop.controllers;

import org.springframework.ui.Model;
import org.springframework.web.bind.annotation.ModelAttribute;

import acn.spring.service.ShopService;

public abstract class BaseCategoryController {

	private ShopService shopService;

	public BaseCategoryController(ShopService shopService) {
		this.shopService = shopService;
	}

	public ShopService getShopService() {
		return shopService;
	}

	@ModelAttribute
	public void populateCategories(Model model) {
		model.addAttribute(shopService.getAllCategories());
	}

}
